package yu.code.consumer;

import yu.code.model.User;
import yu.code.service.UserService;
import yu.code.yurpc.config.RpcConfig;
import yu.code.yurpc.proxy.ServiceProxyFactory;
import yu.code.yurpc.utils.ConfigUtils;

//简单消费者示例
public class EasyConsumerExample {
    public static void main(String[] args) {
        RpcConfig rpc = ConfigUtils.loadConfig(RpcConfig.class, "rpc");
        System.out.println(rpc);
        UserService userService = null;
        User user = new User("yu", 18, "beijing");
        userService = ServiceProxyFactory.getProxy(UserService.class);
        if (userService != null) {
            System.out.println("UserName:" + userService.getUser(user).getName());
            //System.out.println("Number:"+userService.getNumber());
        } else {
            System.out.println("userService is null");
        }
    }
}
